package com.example.monitoringsystem.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.monitoringsystem.bean.Health;
import com.example.monitoringsystem.mapper.HealthMapper;
import com.example.monitoringsystem.service.ManagerStatisticPatientService;
import com.example.monitoringsystem.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class ManagerStatisticPatientServiceImpl implements ManagerStatisticPatientService {
    @Autowired
    private HealthMapper healthMapper;


    @Override
    public List<Health> getAllHealthImformationOfPatient(Integer patientId) {
        return healthMapper.selectList(new QueryWrapper<Health>().eq("id",patientId).orderByAsc("date"));
    }

    @Override
    public List<Health> getAllHealthImformationOfDate(Date date) {
        return healthMapper.selectList(new QueryWrapper<Health>().eq("date",date));
    }

    @Override
    public List<Health> getAllHealthImformationToday() {
        return getAllHealthImformationOfDate(DateUtils.getCurrentSqlDate());
    }
}
